<?php

require_once APP_ROOT_PATH.'system/utils/es_cookie.php';
if(!function_exists('app_conf'))
{
$sys_config = require APP_ROOT_PATH.'system/config.php';
function app_conf($name)
{
return stripslashes($GLOBALS['sys_config'][$name]);
}
}
class es_session 
{
static function id()
{
return session_id();
}
static function start()
{
session_set_cookie_params(0,app_conf('COOKIE_PATH'),app_conf('DOMAIN_ROOT'));
@session_start();
}
static function is_set($name) {
return isset($_SESSION[app_conf('AUTH_KEY').$name]);
}
static function get($name) {
$value   = $_SESSION[app_conf('AUTH_KEY').$name];
return $value;
}
static function set($name,$value) {
$_SESSION[app_conf('AUTH_KEY').$name]  =   $value;
}
static function delete($name) {
unset($_SESSION[app_conf('AUTH_KEY').$name]);
}
static function clear() {
session_destroy();
}
static function close()
{
@session_write_close();
}
static function  is_expired()
{
if (isset($_SESSION[app_conf('AUTH_KEY').'expire']) &&$_SESSION[app_conf('AUTH_KEY').'expire'] <get_gmtime()) {
return true;
}else {
$_SESSION[app_conf('AUTH_KEY').'expire'] = get_gmtime()+(intval(app_conf('EXPIRED_TIME'))*60);
return false;
}
}
}

?>